import { Module } from '@nestjs/common'
import { JwtService } from './jwt.service'
import { JwtModule as BaseJwtServie } from '@nestjs/jwt'
import { ConfigService } from 'src/common/config/config.service'
import { JwtStrategy } from './jwt.strategy'

@Module({
   imports: [
      BaseJwtServie.registerAsync({
         inject: [ConfigService],
         useFactory: (config: ConfigService) => {
            return { secret: config.get('app_secret') }
         }
      })
   ],
   providers: [JwtService, JwtStrategy],
   exports: [JwtService]
})
export class JwtModule {}
